import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WithdrawVO, WithdrawForm, WithdrawQuery } from '@/api/device/withdraw/types';

/**
 * 查询提现列表
 * @param query
 * @returns {*}
 */

export const listWithdraw = (query?: WithdrawQuery): AxiosPromise<WithdrawVO[]> => {
  return request({
    url: '/device/withdraw/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询提现详细
 * @param withdrawId
 */
export const getWithdraw = (withdrawId: string | number): AxiosPromise<WithdrawVO> => {
  return request({
    url: '/device/withdraw/' + withdrawId,
    method: 'get'
  });
};

/**
 * 新增提现
 * @param data
 */
export const addWithdraw = (data: WithdrawForm) => {
  return request({
    url: '/device/withdraw',
    method: 'post',
    data: data
  });
};

/**
 * 修改提现
 * @param data
 */
export const updateWithdraw = (data: WithdrawForm) => {
  return request({
    url: '/device/withdraw',
    method: 'put',
    data: data
  });
};

/**
 * 删除提现
 * @param withdrawId
 */
export const delWithdraw = (withdrawId: string | number | Array<string | number>) => {
  return request({
    url: '/device/withdraw/' + withdrawId,
    method: 'delete'
  });
};
